package app.srong.util.translate;


import app.srong.vo.TransResult;
import com.alibaba.fastjson.JSON;

public class Main {

    /*
    关于翻译API，在网上找到几个有道比较靠谱的API，将API地址、网址等信息记录一下，待自己讲单词的信息好好补充一下
    https://blog.csdn.net/u012987201/article/details/45198681
    API：http://fanyi.youdao.com/openapi.do?keyfrom=youdao111&key=60638690&type=data&doctype=xml&version=1.1&q=%s

    https://blog.csdn.net/weixin_34019929/article/details/90683230?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-5.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-5.channel_param
    这里包含了一个API的KEY值，应该能重复使用。


     */

    // 在平台申请的APP_ID 详见 http://api.fanyi.baidu.com/api/trans/product/desktop?req=developer
    private static final String APP_ID = "20200808000537931";
    private static final String SECURITY_KEY = "O3gu8mFEqlFZialIbTcC";

    public static void main(String[] args) {
        TransApi api = new TransApi(APP_ID, SECURITY_KEY);

        String query = "text";
        String transResult = api.getTransResult(query, "auto", "zh");
        System.out.println(transResult);

        TransResult transResult1 = JSON.parseObject(transResult, TransResult.class);
        System.out.println(transResult1);

    }

}
